package acm;

import java.util.Scanner;

public class 区间k大数查询 {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int size,number,l,r,k,max,x,m,xb=0;
        size=in.nextInt();
        int[] shulie=new int[size+1];
        int[] maxs=new int[size+1];
        for (int i=1;i<=size;i++){
            shulie[i]=in.nextInt();
        }
        number=in.nextInt();
        int[] result=new int[number];
        for (int j=0;j<number;j++){
            for (int i=1;i<=size;i++){
                maxs[i]=shulie[i];
            }
            l=in.nextInt();
            r=in.nextInt();
            k=in.nextInt();
            for ( m=l;m<=r;m++){
                max=0;
                for ( x=m;x<=r;x++){
                    if (max<maxs[x]){
                        max=maxs[x];
                        xb=x;
                    }
                }
                maxs[xb]=maxs[m];
                maxs[m]=max;
            }
            result[j]=maxs[k+l-1];
        }
        for (int n=0;n<number;n++){
            System.out.println(result[n]);
        }
    }
}
